import UseLocalStorage from "./UseLocalStorage"

export function ifString (c: any) {
  return typeof c === 'string'
}

export function ifNumber (c: any) {
  return typeof c === 'number'
}

export function ifArrary (c: any) {
  return Array.isArray(c)
}

export function ifObject (c: any) {
  return typeof c === 'object'
}

export function ifStringNull (c: any) {
  return c === ''
}

export function ifNull(c: any) {
  return c === null;
} 
export function ifloginuser() {
  if(UseLocalStorage().localStorageId === null) {
    return false
  }
  return true
}

export function ifloginusername(c: string | undefined): boolean {
  const res = window.localStorage.getItem('user')
  let username = ''
  if(res !== null) {
    username = JSON.parse(res).username
    return username === c
  }
  return false
}